layui.use(['flow','jquery'], function(){
  var $ = layui.jquery;
  var flow = layui.flow;
  flow.load({
    elem: 'section'
    ,isAuto: true
    ,isLazyimg: true
    ,end: '更多图片请查看分类'
    ,done: function(page, next){
      setTimeout(function(){
      var lis = [];
      $.ajax({
        url: '/index/ajaxPic.html',
        data: {page: page},
        type: 'POST',
        dataType: 'json',
        success: function(json){
          var data = json;
          var arr = Object.keys(data.list);
          if(data.code == 1){ 
            for(var i = 0; i < arr.length; i++){   
              var str = '<div class="layui-box">'
                        +'<a class="layui-thumb" href="/detail/'+data.list[i].id+'.html"><img src="'+data.list[i].thumb+'?x-oss-process=style/midpic" alt="'+data.list[i].title+'" /></a>'
                        +'<div class="layui-title"><h2><a href="/detail/'+data.list[i].id+'.html" title="'+data.list[i].title+'">'+data.list[i].title+'</a></h2></div>'
                        +'<div class="layui-tips"><div class="layui-posttime"><i class="layui-icon">&#xe609;</i><span class="layui-badge layui-date">'+data.list[i].inputtime+'</span></div></div>'
                        +'</div>';
              lis.push(str);     	
            }
            next(lis.join(''), page < data.pagetotal);
          }else{
            return false;
          }
        }
      });
   	  },500);
    }
  });
});